package com.ybxx.asset.service.impl;

import java.util.List;

import org.apache.commons.lang.StringUtils;

import com.ybxx.asset.dao.CompanyDao;
import com.ybxx.asset.model.Company;
import com.ybxx.asset.service.CompanyService;
import com.ybxx.core.command.QueryFilter;
import com.ybxx.core.dao.GenericDao;
import com.ybxx.core.service.impl.BaseServiceImpl;
import com.ybxx.hr.model.Dept;

public class CompanyServiceImpl extends BaseServiceImpl<Company> implements
		CompanyService {
	private CompanyDao companyDao;
	public CompanyServiceImpl(CompanyDao dao) {
		super(dao);
		this.companyDao=dao;
		// TODO Auto-generated constructor stub
	}
	public List<Company> queryPage(Company company,QueryFilter filter) {
		String hql="from Company c";
		String condition=" where ";
		if(company!=null && StringUtils.isNotEmpty(company.getCname())){
			hql+=condition+" c.cname like '%"+company.getCname()+"%' ";
		}
		return companyDao.findByHql(hql, null,filter.getPagingBean());
	}
}
